The LOOPBACK Sample accompanies Chapter 11 and illustrates how to do input and output to a bulk transfer pipe. This sample accommodates application requests of any size by recycling a single IRP.
The sample includes three components:
To build LOOPBACK.SYS, follow the general instructions for building a WDM sample. The Microsoft Visual C++ project file is named LOOPBACK.DSP in the SYS subdirectory.
To build TEST.EXE, follow the general instructions for building user-mode programs. The Microsoft Visual C++ project file is named TEST.DSP in the TEST subdirectory.
First follow the general instructions for testing USB samples to install the device firmware (LOOPBACK.HEX in the EZUSB subdirectory) and the driver. Then open a command prompt and run TEST.EXE from the TEST\DEBUG subdirectory. TEST will output some data to the LOOPBACK device, read it back, and compare the input data to the output data to verify successful operation.
Currently, TEST only tries to transfer a small number of bytes. You might try modifying TEST to transfer more than 4096 bytes in order to see the multistage scenario unfold that LOOPBACK supports. My very lame firmware can't keep up with a long transfer, however, and you will probably receive a buffer overrun error during the read-back phase of the test. This is not the fault of the driver, though.